package com.ddwl.user.controller;

import com.ddwl.common.annotation.Auth;
import com.ddwl.common.constant.BaseEnum;
import com.ddwl.common.controller.BaseController;
import com.ddwl.schema.bo.base.PageBo;
import com.ddwl.schema.bo.user.LoginLogPageBo;
import com.ddwl.schema.vo.base.PageVo;
import com.ddwl.schema.vo.base.RestVo;
import com.ddwl.schema.vo.user.LoginLogVo;
import com.ddwl.user.service.LoginLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author hemiaojun
 * @Date 2020/11/24 9:40
 */
@RestController
@RequestMapping("/liginLog")
@Api(tags = "登录日志")
public class LoginLogController extends BaseController {

    @Resource
    private LoginLogService loginLogService;


    @PostMapping("/consolePage")
    @Auth(product = BaseEnum.ProductEnum.CONSOLE)
    @ApiOperation("后台登录日志分页")
    public RestVo<PageVo<LoginLogVo>> consolePage(@RequestBody PageBo<LoginLogPageBo> pageBo){
        pageBo.getParam().setPk(BaseEnum.ProductEnum.CONSOLE.getName());
        return RestVo.ok(loginLogService.consolePage(pageBo));
    }

}
